package com.ergwang.eduservice.controller;

import com.ergwang.commonutils.R;
import org.springframework.web.bind.annotation.*;

/**
 * @author ergwang
 * @version 1.0
 * @date 2021-2-19 16:37
 */
@RestController
@RequestMapping("/eduservice/user")
@CrossOrigin //解决跨域问题
public class EduLoginController {

    /**
     * login
     */
    @PostMapping("login")
    public R login(){
        return R.ok().data("token","admin");
    }

    /**
     * info
     */
    @GetMapping("info")
    public R info(){
        return R.ok()
                .data("roles","[admin]")
                .data("name","admin")
                .data("avatar","https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fp1.pstatp.com%2Flarge%2Fpgc-image%2F1525459425380f8e1dc6541%3F%2F1.jpg&refer=http%3A%2F%2Fp1.pstatp.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1616316464&t=f8173814b24f2c644477ab782bf0de07");
    }

    /**
     * logout
     */
    @PostMapping("logout")
    public R logout(){
        return R.ok().data("token","");
    }

}
